Wheat Molecular Genetics | Preharvest Sprouting
Great article on getting started with an electronic notebook. A Nature article about why so many scientists love Jupyter Notebook (I am biased, I know).
How to output nice tables in R: a list of packages and 5 package tutorials A compare and contrast of how the Economist presents their data figures.
Github Wiki | Github markdown| md Basics | Typora document | R md document K. Broman has a great blog (is that what you call it?) on R Markdown
Jupyter Notebook shortcuts Datacamps Jupyter and R markdown cheatsheet
If recently unused, I often forget these coding commands or shortcuts and I have to google search them again. Instead, I just keep my running list of forgotten favorites listed here
All research files are backed up onto GitHub
git pull origin master
: Updates this computers master folder with changes from the other computer
git status
: Tells you what has changed since the last push
git add -u
: This tells git to automatically stage tracked files – including deleting the previously tracked files.
OR git add /folder
to add a whole specific folder of changes
git commit -m 'enter commit comment here'
git push origin master
Enter in user name (email) and password
Use the Anaconda terminal to access Jupyter Notebook
cd /d D:
cd /d General\ Research\ Files/
jupyter notebook
This will start Jupyter Notebook in the web browser
Notebooks are found in the /Lab notebook/
folder
Shorthand keys
Shift-Enter
run cell, select below
Ctrl-Enter
run cell
Alt-Enter
run cell, insert below
M
to markdown (remember to esc from edit mode) Y
to code
Green Text
: Green Text
Red Text
: Red Text
Blue Text
: Blue Text
Colors only work when the md output is html ex: github pages or jupyter notebooks
<a id="abbr_name"></a>
: Header link()[#abbr_name]: Reference Header Link : Tab 6 spaces
<div style="text-align: right"> [TOC](#TOC) </div>
--------------
creates a line break
Ctrl+/
: Source Code Mode
Ctrl+Shift+-
: Zoom Out
Ctrl+Shift+=
: Zoom In
colnames(k)<- sub("X","",colnames(k))
replace column name characters like X or V with nothing. This is useful when importing data tables and R formats the empty column names.
c("#F8766D", "#7CAE00", "#00BFC4","#C77CFF")
: default ggplot2 colors
2
length(df[!is.na(df)])
Tells me how many values in the df are NOT NA. you can also specify col df$col
CV <- subset(CNLM, GID %in% myCVc$taxa)
Subsetting CNLM with similar GID as myCV taxa, There are 1059 GID in common
PCC<- merge(myCVc,CV,by="ID")
merge columns by two columns with the same name
names(myCVc)[14] <- "GID"
rename column 14 only
PHSred7$GIDx <- with(PHSred7,paste("cuGS",PHSred7$GID,sep=""))
Make dfGID ### to dfGID ### to dfGIDx cuGS### by adding a new row
PHSwhite$GIDx <- gsub("cuGSOH", "OH", PHSwhite\$GIDx)
replace cuGSOH in column GIDx with OH.
lme4
VarName
: Fixed Effect
(1|VarName)
: Random Effect; random intercept with fixed mean
x + (x|VarName)
: Random Effect; correlated intercept and slope with the fixed effect x
(1|Env%in%GID)
: Random effect interaction; GID within Env
Rounding adapted from KBroman
If you want and ouput value of 0.70, and don’t want to see 0.7035597 … you can use r round(cor(x,y), 2)
or r sprintf("%.2f", cor(x,y))
but its, of course, not perfect.
Broman’s solution to this problem was to create a function myround
in my R/broman package library(broman)
. Now you can write r myround(cor(x,y), 2)
and it would give 0.70 or -0.001 in the way that you want.